package com.chaopei.myobj;

/**
 * @Author Corday 天涯
 * @Date 2022/3/8 9:29
 */
public class Student {
    private Integer sid;
    private String name;
    private String gender;
    public  Student(){}
    public Student(Integer sid, String name, String gender) {
        this.sid = sid;
        this.name = name;
        this.gender = gender;
    }

    public Integer getSid() {
        return sid;
    }

    public void setSid(Integer sid) {
        this.sid = sid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    @Override
    public String toString() {
        return this.sid+":"+this.name+":"+this.gender;
    }
    //    可以调用Object类的公共的方法

    @Override
    public boolean equals(Object obj) {
        if(obj instanceof Student){
            Student stu = (Student) obj;
            return true;
        }
        return false;
    }

    @Override
    public int hashCode() {
        return sid+this.name.hashCode()<<2+this.gender.length()<<3;
    }
}
